import { Injectable } from '@angular/core';
import { HttpClient } from '../../../providers/httpClient';
import { Config } from '../../../providers/config';

@Injectable()
export class SettingIndexService {
	constructor(
		public httpClient: HttpClient,
		public config: Config
	) { }

	changePushStatus(status, subPush, token) {
		let postBody = {
			"isPush": status,
      "subPush": JSON.stringify(subPush),
			"pushToken": token
		};
		return this.httpClient.post(postBody, {
			url: this.config.server + "api/v1/users/edit",
      isShowLoading: false
		});
	}

	logout() {
		let postBody = {};
		return this.httpClient.post(postBody, {
			url: this.config.server + "api/v1/users/logout",
			isShowLoading: true
		});
	}
}
